/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package net.jonbuck.tassoo.model.provider;

import java.util.Collection;
import java.util.List;

import net.jonbuck.tassoo.model.AttachmentType;
import net.jonbuck.tassoo.model.TassooPackage;
import net.jonbuck.tassoo.model.util.ApplicationImages;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemColorProvider;
import org.eclipse.emf.edit.provider.IItemFontProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITableItemColorProvider;
import org.eclipse.emf.edit.provider.ITableItemFontProvider;
import org.eclipse.emf.edit.provider.ITableItemLabelProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;

/**
 * This is the item provider adapter for a {@link net.jonbuck.tassoo.model.AttachmentType} object.
 * <!-- begin-user-doc
 * --> <!-- end-user-doc -->
 * @generated
 */
public class AttachmentTypeItemProvider extends BaseObjectItemProvider implements IEditingDomainItemProvider,
		IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, ITableItemLabelProvider,
		ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider {
	/**
	 * This constructs an instance from a factory and a notifier. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public AttachmentTypeItemProvider(AdapterFactory adapterFactory) {
		super(adapterFactory);
	}

	/**
	 * This returns the property descriptors for the adapted class. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Override
	public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
		if (itemPropertyDescriptors == null) {
			super.getPropertyDescriptors(object);

			addArgumentsPropertyDescriptor(object);
			addCommandPropertyDescriptor(object);
			addExtensionPropertyDescriptor(object);
			addIconPropertyDescriptor(object);
			addNamePropertyDescriptor(object);
			addSelectionExpressionPropertyDescriptor(object);
			addTypePropertyDescriptor(object);
		}
		return itemPropertyDescriptors;
	}

	/**
	 * This adds a property descriptor for the Arguments feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addArgumentsPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_AttachmentType_arguments_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_AttachmentType_arguments_feature", "_UI_AttachmentType_type"),
				 TassooPackage.Literals.ATTACHMENT_TYPE__ARGUMENTS,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Name feature.
	 * <!-- begin-user-doc
	 * --> <!-- end-user-doc -->
	 * @generated
	 */
	protected void addNamePropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_AttachmentType_name_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_AttachmentType_name_feature", "_UI_AttachmentType_type"),
				 TassooPackage.Literals.ATTACHMENT_TYPE__NAME,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Selection Expression feature.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	protected void addSelectionExpressionPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_AttachmentType_selectionExpression_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_AttachmentType_selectionExpression_feature", "_UI_AttachmentType_type"),
				 TassooPackage.Literals.ATTACHMENT_TYPE__SELECTION_EXPRESSION,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Type feature.
	 * <!-- begin-user-doc
	 * --> <!-- end-user-doc -->
	 * @generated
	 */
	protected void addTypePropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_AttachmentType_type_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_AttachmentType_type_feature", "_UI_AttachmentType_type"),
				 TassooPackage.Literals.ATTACHMENT_TYPE__TYPE,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Command feature. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	protected void addCommandPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_AttachmentType_command_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_AttachmentType_command_feature", "_UI_AttachmentType_type"),
				 TassooPackage.Literals.ATTACHMENT_TYPE__COMMAND,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Extension feature. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	protected void addExtensionPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_AttachmentType_extension_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_AttachmentType_extension_feature", "_UI_AttachmentType_type"),
				 TassooPackage.Literals.ATTACHMENT_TYPE__EXTENSION,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Icon feature.
	 * <!-- begin-user-doc
	 * --> <!-- end-user-doc -->
	 * @generated
	 */
	protected void addIconPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_AttachmentType_icon_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_AttachmentType_icon_feature", "_UI_AttachmentType_type"),
				 TassooPackage.Literals.ATTACHMENT_TYPE__ICON,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected boolean shouldComposeCreationImage() {
		return true;
	}

	/**
	 * This returns the label text for the adapted class.
	 * <!-- begin-user-doc
	 * --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String getText(Object object) {
		String label = ((AttachmentType)object).getName();
		return label == null || label.length() == 0 ?
			getString("_UI_AttachmentType_type") :
			getString("_UI_AttachmentType_type") + " " + label;
	}

	/**
	 * @generated_not
	 */
	public Object getColumnImage(Object object, int columnIndex) {
		AttachmentType attachmentType = (AttachmentType) object;
		switch (columnIndex) {
		case 0:
			return ApplicationImages.getImage(attachmentType.getIcon());
		}
		return null;
	}

	/**
	 * @generated_not
	 */
	public String getColumnText(Object object, int columnIndex) {
		AttachmentType attachmentType = (AttachmentType) object;
		switch (columnIndex) {
		case 0:
			return attachmentType.getName();
		case 1:
			return attachmentType.getType();
		case 2:
			return attachmentType.getCommand();
		case 3:
			return attachmentType.getExtension();
		}
		return null;
	}

	/**
	 * This handles model notifications by calling {@link #updateChildren} to update any cached
	 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
	 * <!-- begin-user-doc --> <!--
	 * end-user-doc -->
	 * @generated
	 */
	@Override
	public void notifyChanged(Notification notification) {
		updateChildren(notification);

		switch (notification.getFeatureID(AttachmentType.class)) {
			case TassooPackage.ATTACHMENT_TYPE__ARGUMENTS:
			case TassooPackage.ATTACHMENT_TYPE__COMMAND:
			case TassooPackage.ATTACHMENT_TYPE__EXTENSION:
			case TassooPackage.ATTACHMENT_TYPE__ICON:
			case TassooPackage.ATTACHMENT_TYPE__NAME:
			case TassooPackage.ATTACHMENT_TYPE__SELECTION_EXPRESSION:
			case TassooPackage.ATTACHMENT_TYPE__TYPE:
				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
				return;
		}
		super.notifyChanged(notification);
	}

	/**
	 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
	 * describing the children that can be created under this object. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Override
	protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
		super.collectNewChildDescriptors(newChildDescriptors, object);
	}

}
